//
//  FirstAuditingSearchView.m
//  优学荟管理系统
//
//  Created by 星道 on 17/7/11.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "FirstAuditingSearchView.h"

@implementation FirstAuditingSearchView
{
    IBOutlet UITextField *_SearchTextField;
    void(^_SearchResult)(NSString *);
}


#pragma mark - 实例化
// 类创建
+ (instancetype)ConfigSearchViewWithSearchResult:(void (^)(NSString *))SearchResult
{
    return [[self alloc] initWithSearchResult:SearchResult];
}

// 实例
- (instancetype)initWithSearchResult:(void(^)(NSString *))SearchResult
{
    self = [[[NSBundle mainBundle] loadNibNamed:[FirstAuditingSearchView description]  owner:self options:nil] lastObject];
    if (self)
    {
        _SearchResult = SearchResult;
        _SearchTextField.delegate = self;
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH*0.8, 30);
    }
    return self;
}







// id输入之后点return
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    if (_SearchResult)
    {
        NSString *Str = textField.text.length <= 0 ? @"-1":textField.text;
        _SearchResult (Str);
    }
    return YES;
}
@end
